%% [output] = ClassifyAdaboost(features, model);
%
% Inputs
%   - features: dxN (d = dimension of the space, N = num of samples)
%   - model (struct build with TrainAdaboost.m)
%
% Outputs
%    - output: 1xN;
%
% -------------------------------------------------------------------------
% matias di martino (2012), matiasdm@fing.edu.uy
% -------------------------------------------------------------------------


function [output] = ClassifyAdaboost(features, model);

alphas = model.alphas;
coordinate_wls = model.coordinate_wls;
theta_wls = model.theta_wls;
polarity_wls = model.polarity_wls;

NumOfBoostingRounds = size(alphas,1);

numsamples = size(features,2);
% inicialization 
output = zeros(1,numsamples);

for it = 1:NumOfBoostingRounds,    
    
    [weak_learner_output]  = evaluate_stump(features,coordinate_wls(it),polarity_wls(it),theta_wls(it));
   
    % add current weak learner's response to overall response
    output   = output   + alphas(it).*weak_learner_output;
end

